<template>
    <div>
        <el-table :data="$store.getters['seck/getSeck']" border style="width: 100%">
            <el-table-column prop="title" label="活动名称" width="180">
            </el-table-column>
            <el-table-column  label="状态" width="180">
                <template slot-scope="item">
                    <div>
                        <el-button type="success" size="mini" plain>{{ item.row.status == 1 ? '启用' : '禁用' }}</el-button>
                    </div>
                </template>
            </el-table-column>
            <el-table-column  label="操作">
                <template slot-scope="item">
                    <div>
                        <el-button type="primary" icon="el-icon-edit"  size="mini" @click="edit(item.row.id)">编辑</el-button>
                        <el-button type="danger" icon="el-icon-delete"  size="mini" @click="del(item.row.id)">删除</el-button>
                    </div>
                </template>
            </el-table-column>
        </el-table>
    </div>
</template>
<script>
import {seckdelete} from '../../request/api'
export default {
    data() {
        return {
            
        }
    },
    methods: {
        edit(id){
            this.$emit('edit',id)
        },
        // 删除
        del(id){
            this.$confirm('此操作将永久删除该文件, 是否继续?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
            seckdelete({id})
            .then(res=>{
                if(res.code==200){
                    this.$store.dispatch('seck/GetSeckInfo')
                    this.$message.success(res.msg)
                }else{
                    this.$message.error(res.msg)
                }
            })
        }).catch(() => {
          this.$message({
            type: 'info',
            message: '已取消删除'
          });          
        });
        }
    },
    mounted() {
        console.log(this.$store);
        this.$store.dispatch('seck/GetSeckInfo')
     },
    watch: {},
    computed: {},
    filters: {},
    components: {}
}
</script>
<style scoped></style>